/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Controllayer;
import DBlayer.*;
import java.util.ArrayList;
import Modellayer.*;

/**
 *
 * @author bruhn
 */
public class InvoiceCtr {

        public InvoiceCtr()
        {
        }

        public ArrayList getAllInvoices()
        {
            IFDBInvoice dbInvoice = new DBInvoice();
            ArrayList invoices = new ArrayList();
            invoices = dbInvoice.getAllInvoices(false);
            return invoices;
        }

        public Invoice findInvoice(int invoiceNo, boolean retriveAssociation)
	{
		IFDBInvoice dbInvoice = new DBInvoice();
                return dbInvoice.findInvoice(invoiceNo, true);
	}

	public int updateInvoice(int invoiceNo, String paymentDate, String Status, SalesOrder orderList)
      {
          IFDBInvoice dbInvoice = new DBInvoice();
          Invoice inv = new Invoice();
          inv.setInvoiceNo(invoiceNo);
          inv.setPaymentDate(paymentDate);
          inv.setStatus(Status);
          inv.setOrder(orderList);
          return  dbInvoice.updateInvoice(inv);
      }

        public void insertInvoice(Invoice invObj)
      {
           IFDBInvoice dbInvoice = new DBInvoice();
           dbInvoice.insertInvoice(invObj);
      }

		public void deleteInvoice(int ID)
	{
		IFDBInvoice dbInvoice = new DBInvoice();
		dbInvoice.deleteInvoice(ID);
	}
}
